home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 1 / Gold Medal Software Volume 1 (Gold Medal) (1994).iso / prog / tpwprog7.arj / INANDOUT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-07-02  |  1006 b   |  44 lines

  1. { inandout.pas -- Demonstrate DLL entry and exit code }
  2.  
  3. library InAndOut;
  4.  
  5. uses WinTypes, WinProcs;
  6.  
  7. const
  8.  
  9.   caption = 'InAndOut DLL';  { Caption for message box }
  10.  
  11. var
  12.  
  13.   Chain: Pointer;   { Exit chain pointer }
  14.  
  15. {$S-}    { Stack checking must be off for exit procedures }
  16.  
  17. {- DLL exit procedure. Runs when DLL is unloaded }
  18. procedure DLLExitProc; far;
  19. begin
  20.   if ExitCode = wep_Free_DLL then
  21.   begin
  22.     { Perform any DLL shutdown chores here }
  23.     MessageBox(0, 'Unloading library', caption,
  24.       mb_TaskModal or mb_Ok);
  25.   end else
  26.   begin
  27.     { System is shutting down }
  28.   end;
  29.   ExitProc := Chain
  30. end;
  31.  
  32. begin
  33.   MessageBox(0, 'Loading library', caption,
  34.     mb_TaskModal or mb_Ok);
  35.   Chain := ExitProc;
  36.   ExitProc := @DLLExitProc
  37. end.
  38.  
  39.  
  40. {--------------------------------------------------------------
  41.   Copyright (c) 1991 by Tom Swan. All rights reserved.
  42.   Revision 1.00    Date: 5/25/1991
  43. ---------------------------------------------------------------}
  44.